<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(array('namespace' => '', 'basePath' => APPLICATION_PATH));

        return $autoloader;
    }

    protected function _initLocale() {
        Zend_Registry::set('Zend_Locale', new Zend_Locale('pt_BR'));
        date_default_timezone_set('America/Sao_Paulo');
    }

    protected function _initLoadDependencies() {
        require_once APPLICATION_PATH . '/controllers/BaseController.php';
    }
    
    protected function _initDoctype() {
        $this->bootstrap('view');
        $view = $this->getResource('view');

        // Url Base da Aplicação (Pasta Public)
        $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();

        if (!$baseUrl) {
            $baseUrl = rtrim(preg_replace('/([^\/]*)$/', '', $_SERVER['PHP_SELF']), '/\\');
        }

        $view->doctype('XHTML1_TRANSITIONAL');
        $this->initTitle($view, $baseUrl);
        $this->initFavicon($view, $baseUrl);
        $this->initCss($view, $baseUrl);
        $this->initJs($view, $baseUrl);
    }

    protected function initTitle(Zend_View $view, $baseUrl) {
        $view->headTitle('PAGSERVICE');
    }

    protected function initFavicon(Zend_View $view, $baseUrl) {
        $view->headLink(array('rel' => 'icon', 'href' => $baseUrl . '/favicon.ico'));
        $view->headLink(array('rel' => 'shortcut icon', 'href' => $baseUrl . '/favicon.ico'));
    }

    protected function initCss(Zend_View $view, $baseUrl) {
        $view->headLink()->appendStylesheet($baseUrl . '/css/reset.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/forms.css');
        //$view->headLink()->appendStylesheet($baseUrl . '/css/facebox.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/modal.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/datePicker.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/plupload.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/dataTables.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/jquery-ui-1.8.9.custom.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/estilo.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/print.css', array('media' => 'print'));
        $view->headLink()->appendStylesheet($baseUrl . '/css/tema.css');
    }
    
    protected function initJs(Zend_View $view, $baseUrl) {
        $view->headScript()->appendFile($baseUrl . '/js/jquery-1.6.2.min.js');
        $view->headScript()->appendFile($baseUrl . '/js/jquery.meio.mask.js');
        $view->headScript()->appendFile($baseUrl . '/js/jquery.maskedinput-1.3.js');
        $view->headScript()->appendFile($baseUrl . '/js/jquery.datePicker.js');
        $view->headScript()->appendFile($baseUrl . '/js/date.js');
        $view->headScript()->appendFile($baseUrl . '/js/date_pt-br.js');
        $view->headScript()->appendFile($baseUrl . '/js/pagservice.js');
        
        
    }
    

}

